<?php

namespace app\apiadmin\model\liveManager;

use think\Model;

class LiveInfoModel extends Model
{

    protected $name = "siyu_live_info";

    protected $pk = "id";

    public static function pageMap($map, $offset, $limit)
    {
        return self::where($map)->limit($offset, $limit)->order('create_time desc')->select();
    }

    public static function pageMapCount($map)
    {
        return self::where($map)->count();
    }

    /**
     *  添加一条 直播
     *
     * @param array $param
     * @return bool
     */
    public static function add($param)
    {
        $LiveInfoModel = new LiveInfoModel();
        return $LiveInfoModel->save($param);
    }

    /**
     *  假删除一个直播数据
     *
     * @param int $id
     * @return LiveInfoModel|bool
     */
    public static function del($id)
    {
        $recoder = self::where(['id' => $id])->find();
        if (!empty($recoder)) {
            $ret = LiveInfoModel::update(["del" => 1], ["id" => $id]);
            return $ret;
        }
        return false;
    }

}
